package com.minyifang.wcspf.work.ui.home.presenter;

import com.minyifang.wcspf.common.base.BasePresenter;
import com.minyifang.wcspf.common.config.network.Constants;
import com.minyifang.wcspf.common.config.network.RetrofitHelper;
import com.minyifang.wcspf.work.ui.home.view.HomePage2View;

import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class HomePage2Presenter extends BasePresenter<HomePage2View> {
    public void getClassList() {
        final JSONObject jsonData = Constants.getJsonData(new HashMap<>(), null);
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), jsonData.toString());
        addTask(RetrofitHelper.getInstance().getService().getClassList(requestBody), listHttpRespond -> {
            if (listHttpRespond.result == 1) {
                getView().onGetClassListSucceed(listHttpRespond.data);
            }
        });
    }
}
